<?php
namespace app\admin\validate;
use think\Validate;
class Article extends Validate
{
    //验证规则
    protected $rule = [
        'title'   =>  'require|max:25|unique:article',
        'cateid'  =>  'require',
        'content' =>  'require',
    ];
    //错误提示
    protected $message = [
        'title.require'  => '文章标题必须填写',
        'title.max'      => '文章标题长度不能大于25位',
        'title.unique'   => '文章标题不得重复',
        'cateid.require' => '清选择文章所属栏目',
    ];
    //验证场景
    protected  $scene = [
        'add'  => ['title'=>'require','cateid','content'],
        'edit' => ['title'=>'require','cateid'],
    ];
}
